package com.sky.controller.user;

import com.sky.entity.Setmeal;
import com.sky.result.Result;
import com.sky.service.SetmealUserService;
import com.sky.vo.DishItemVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/setmeal")
@RequiredArgsConstructor
public class SetmealUserController {
    private final SetmealUserService setmealUserService;

    /**
     * @return {@link Result}<{@link ?}>
     */
    @GetMapping("/list")
    public Result<List<Setmeal>> selectSetmeal(String categoryId) {
        List<Setmeal> userSetmealVOS = setmealUserService.selectSetmeal(categoryId);
        return Result.success(userSetmealVOS);
    }

    @GetMapping("/dish/{id}")
    public Result<List<DishItemVO>> selectSetmealDish(@PathVariable String id) {
        List<DishItemVO> dishItemVOS = setmealUserService.selectSetmealDish(id);
        return Result.success(dishItemVOS);
    }
}
